home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: Purity / Purity #22 (1994-01-19)(Diesel)(DE)[WB].zip / Purity #22 (1994-01-19)(Diesel)(DE)[WB].adf / MagicBlank / STARS.h < prev    next >
Text File  |  1994-01-17  |  2KB  |  83 lines

  1. {$if not def MAGICBLANK_STARS_H}
  2.  
  3. CONST
  4.   MAGICBLANK_STARS_H = 0;
  5.  
  6. { --------------------------------------------
  7.   -- Der Weltraum - unendliche Weiten...    --
  8.   -------------------------------------------- }
  9.  
  10. { ********************************************
  11.   *                  InitStars               *
  12.   *                                          *
  13.   * Funktion: Die 12 Sternpositionen und die *
  14.   *           "Geschwindigkeit" der Sterne   *
  15.   *           festlegen.                     *
  16.   ******************************************** }
  17.  
  18. PROCEDURE InitStars;
  19. BEGIN
  20.   for i:=1 to 4 do
  21.   BEGIN
  22.     star[i].x:=Random(sp^.Width);
  23.     star[i].y:=Random(sp^.Height);
  24.     star[i].speedx:=-4;
  25.   END;
  26.   for i:=5 to 8 do
  27.   BEGIN
  28.     star[i].x:=Random(sp^.Width);
  29.     star[i].y:=Random(sp^.Height);
  30.     star[i].speedx:=-6;
  31.   END;
  32.   for i:=9 to 12 do
  33.   BEGIN
  34.     star[i].x:=Random(sp^.Width);
  35.     star[i].y:=Random(sp^.Height);
  36.     star[i].speedx:=-8;
  37.   END;
  38. END;
  39.  
  40. { ********************************************
  41.   *                 Stars                    *
  42.   *                                          *
  43.   * Funktion: Zeichnet einen Sternenhimmel   *
  44.   *           in einer Seitenansicht.        *
  45.   ******************************************** }
  46.  
  47. PROCEDURE Stars;
  48. VAR
  49.  dum : Integer;
  50.  x : LONG;
  51. BEGIN
  52.   dum:=1000;
  53.   sig1 := SetSignal(0,0) AND SBF_CF{SIGBREAKF_CTRL_F};
  54.   InitStars;
  55.   While sig1 = 0 do
  56.   BEGIN
  57.     Dec(dum);
  58.     If dum<=0 then
  59.     BEGIN
  60.       DisplayBeep(sp);
  61.       SetRast(^sp^.RastPort,0);
  62.       Exit;
  63.     END;
  64.     for i:=1 to 12 do
  65.     BEGIN
  66.       SetAPen(^sp^.RastPort,0);
  67.       x:=WritePixel(^sp^.RastPort,star[i].x,star[i].y);
  68.       star[i].x:=star[i].x + star[i].speedx;
  69.       If (star[i].x<0) or (star[i].x>sp^.Width) then
  70.       BEGIN
  71.         star[i].x:=Random(sp^.Width);
  72.         star[i].y:=Random(sp^.Height);
  73.       END;
  74.       SetAPen(^sp^.RastPort,1);
  75.       x:=WritePixel(^sp^.RastPort,star[i].x,star[i].y);
  76.       sig1 := SetSignal(0,0) AND SBF_CF{SIGBREAKF_CTRL_F;}
  77.     END;
  78.     sig1 := SetSignal(0,0) AND {SIGBREAKF_CTRL_F}SBF_CF;
  79.   END;
  80. END;
  81.  
  82. {$endif}
  83.